package com.shaokel.repository;

import com.shaokel.pojo.Type;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author 少丶客
 * @ClassName TypeRepository
 * @Description TODO
 * @Date 2020/6/24 15:55
 * @Vesion 1.0
 */
@Repository
public interface TypeRepository extends JpaRepository<Type,Long> {

    //根据名称查找Type
    Type findByName(String name);

    @Query("select t from Type t")
    List<Type> findTop(Pageable pageable);
}